<form action="${ctx}/userorder/relatedWork" method="post" id="relatedWorkForm" enctype="multipart/form-data">

	<input type="hidden" name="orderId" value="${orderId!}" />
	<div class="form-group form-inline row">
		<div class="col-sm-6">
			<label>关联方式：</label>
			<label class="radio-inline"><input type="radio" name="relateType" value="1" checked >工单ID</label>
			<label class="radio-inline"><input type="radio" name="relateType" value="2">工单编号</label>
		</div>
	</div>
	<div class="form-group form-inline row">
		<div class="col-sm-6" id="workFormIdDiv">
			<label><span style="color: red">*</span>工单ID：</label>
			<input type="text" class="form-control" name="workFormId" digits="true" maxlength="10" required />
		</div>
		<div class="col-sm-6 hide" id="workFormNoDiv">
			<label><span style="color: red">*</span>工单编号：</label>
			<input type="text" class="form-control" name="workFormNo" maxlength="30" required />
		</div>
	</div>
</form>

<script type="text/javascript">
	$("#relatedWorkForm").validate();
	
	/* 切换关联方式 */
	$(':radio[name="relateType"]').change(function(){
		var relateType = $(this).val();
		if(relateType == 1) {
			// 工单ID
			$("#workFormIdDiv").show();
			$("#workFormNoDiv").hide();
			
			$("#workFormIdDiv :input").removeAttr("disabled");
			$("#workFormNoDiv :input").attr("disabled","disabled");
		} else {
			// 工单编号
			$("#workFormIdDiv").hide();
			$("#workFormNoDiv").removeClass("hide");
			$("#workFormNoDiv").show();
			
			$("#workFormIdDiv :input").attr("disabled","disabled");
			$("#workFormNoDiv :input").removeAttr("disabled");
		}
	});
</script>
